<?php

namespace App\Http\Controllers\Front;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

use App\Models\UserCoupon;
use App\Models\Coupon;
use App\Interfaces\CouponService;

class CouponController extends Controller
{
    /**
     * 获取优惠券（网站所有的优惠券）
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request, CouponService $couponService)
    {
        $search = ['type'=>'all'];

        $type = @$request->type;
        if (!empty($type) && $type != 'all') {
            $search['type'] = $type;
        }//end if()

        $coupons = $couponService->getCoupon($search);

        return view('front.coupon.index', compact(['coupons', 'search']));

    }//end func index()


}
